<?

$indexes = array (
	title=>array (label=>"Title",order=>"DEFAULT",wrapper=>"vmc_icon_task",callback=>"_template_list_substring",length=>26),
	lead_user=>array (label=>"Task Lead",order=>"DEFAULT",wrapper=>"vmc_icon_user"),
	total_time=>array (label=>"Total Time",order=>"DEFAULT",wrapper=>"vmc_icon_total_time"),
	status=>array (label=>"Status",order=>"DEFAULT",
			values=>array (
				"active"=>"Active",
				"inactive"=>"Inactive",
				"hold"=>"Hold",
				"suspended"=>"Suspended",
				"processing"=>"Processing",
				"new"=>"New",
				"assigned"=>"Assigned",
				"started"=>"Started",
				"stopped"=>"Stopped",
				"complete"=>"Complete",
			)),
	date_due=>array (label=>"Due Date",order=>"DEFAULT",wrapper=>"vmc_icon_date"),
);

$object_ctl = "/admin/projects/projects/fs_projects.php?fs_tab=tasks&project_id={$_REQUEST["project_id"]}&fs_tab_option=fs_tasks&fs_action=view&";
$link_options = "&fs_action=view&fs_tab=tasks&project_id={$_REQUEST["project_id"]}";
$list_options = array ();

$_OBJECT_IFACE_LIST = _app_create_list_object (array (
		db_conn=>$_GLOBAL_DBH,
		indexes=>$indexes,
		list_count=>"SELECT COUNT(*) FROM project_tasks WHERE project_id={$_REQUEST["project_id"]} AND current_id={$_APP_SESSION_USER->id}",
		list_select=>"
		SELECT project_tasks.*,
			(SELECT CONCAT(last,', ',first)
				FROM users
				WHERE id=current_id)
			AS lead_user, 
			(SELECT SEC_TO_TIME(SUM(
				CASE project_task_timer.date_end
					WHEN '' THEN UNIX_TIMESTAMP()
					ELSE UNIX_TIMESTAMP(project_task_timer.date_end)
				END - UNIX_TIMESTAMP(project_task_timer.date_begin)))
			FROM project_task_timer
			WHERE task_id=project_tasks.id)
		AS total_time
		FROM project_tasks
		WHERE project_id={$_REQUEST["project_id"]}
		AND current_id={$_APP_SESSION_USER->id}",
		list_id=>"lc_project_task_tcurrent",
		list_title=>"&nbsp;&raquo;&nbsp;Current Tasks",
		list_options=>$list_options,
		primary_key=>"id",
		primary_relation=>"task_id",
		link_options=>$link_options,
		object_ctl=>$object_ctl
));

$_OBJECT_IFACE_TABBING_PANEL->insert_container ($_OBJECT_IFACE_LIST);

?>
